#include "win.h"
#include "util.h"
#include <windows.h>
#include <wtsapi32.h>


static WINBOOL __stdcall proc(HWND hwnd, LPARAM param)
{

    DWORD TID;
    GetWindowThreadProcessId(hwnd, &TID);

    if (TID == (DWORD)param)
    {
        DHS_LOG("TID %d pid %d\n", TID, param);
        SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
        DHS_LOG("EnumWindows\n");
        return FALSE;
    }

    return TRUE;
}


void topWindow()
{

    while (TRUE)
    {
        BEGIN_EXCEPT
        DWORD pid = GetCurrentProcessId();
        EnumWindows(proc, pid);
        END_EXCEPT
        Sleep(2000);
    }
}
